#!/usr/bin/env python

import BaseHTTPServer
import CGIHTTPServer
import cgitb; cgitb.enable()  ## This line enables CGI error reporting


def run(port=8000):
    print "starting at http://localhost:%d/cgi/index.html"%port
    server = BaseHTTPServer.HTTPServer
    handler = CGIHTTPServer.CGIHTTPRequestHandler
    server_address = ("", port)
    handler.cgi_directories = ["/cgi"]

    httpd = server(server_address, handler)
    httpd.serve_forever()


if __name__ == "__main__":
    print "ll"
    import sys
    if len(sys.argv)>1:
        run( int(sys.argv[1]) )
    else:
        run()

# http://localhost:8000/cgi/index.html
